home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 301-325 / disk_319 / cnewssrc / cnews.orig.lzh / conf / build next >
Text File  |  1989-06-27  |  31KB  |  1,047 lines

  1. #! /bin/sh
  2.  
  3. # functions and headers we are prepared to fake
  4. mightfake='fsync getopt index memcpy memcmp memchr memset mkdir
  5.     putenv rindex strchr strrchr strpbrk strspn strcspn strtok symlink'
  6. mightfakehdrs='stdlib.h string.h'
  7.  
  8. # directories in which to do makes
  9. # batch must precede input; relay must precede misc
  10. pgmdirs='conf batch expire input relay misc rna'
  11.  
  12. # control files built in conf
  13. ctlf="active allowed errlog history history.pag history.dir localgroups"
  14. ctlf="$ctlf log mailname mailpaths organization postdefltdist postdefltgroup"
  15. ctlf="$ctlf replyusepath server sys whoami"
  16.  
  17. echo 'This interactive command will build shell files named doit.root,'
  18. echo 'doit.bin, doit.news, and again.root to do all the work.  It will not'
  19. echo 'actually do anything itself, so feel free to abort and start again.'
  20. echo
  21. echo 'You probably need your system manuals handy.'
  22. echo
  23. echo 'When a question is asked in the form "How are you [okay]? ", the'
  24. echo 'answer in brackets is what you will get if you just hit RETURN.'
  25.  
  26. chmod +x query            # just in case
  27. if test " `./query hi | wc -c`" -ne 2
  28. then
  29.     echo 'The "query" utility that this command needs does not seem to'
  30.     echo 'be working properly.  It is supposed to work like "echo"'
  31.     echo 'except not produce a newline at the end.  You will have to fix'
  32.     echo 'it (it is a shell file).  (Most versions of "echo" have a way'
  33.     echo 'to suppress the newline, but unfortunately there are at least'
  34.     echo 'two different incompatible ways.)'
  35.     exit 1
  36. fi
  37.  
  38. echo
  39. echo 'C News wants to keep most of its files under a uid which preferably'
  40. echo 'should be all its own.  Its programs, however, can and probably should'
  41. echo 'be owned by another user, typically the same one who owns most of the'
  42. echo 'rest of the system.'
  43. ./query 'What user id should be used for news files [news]? '
  44. read newsuid
  45. case "$newsuid" in
  46. '')    newsuid=news    ;;
  47. esac
  48. ./query 'What group id should be used for news files [news]? '
  49. read newsgid
  50. case "$newsgid" in
  51. '')    newsgid=news    ;;
  52. esac
  53. ./query 'What user id should be used for news programs [bin]? '
  54. read binuid
  55. case "$binuid" in
  56. '')    binuid=bin    ;;
  57. esac
  58. ./query 'What group id should be used for news programs [bin]? '
  59. read bingid
  60. case "$bingid" in
  61. '')    bingid=bin    ;;
  62. esac
  63.  
  64. answer=
  65. if test -d /var -a -d /usr/share
  66. then
  67.     echo
  68.     echo 'It would appear that your system is among the victims of the'
  69.     echo '4.4BSD / SVR4 directory reorganization, with (e.g.) shared'
  70.     ./query 'data in /usr/share.  Is this correct [yes]? '
  71.     read answer
  72.     case "$answer" in
  73.     y*|Y*|'')    answer=y    ;;
  74.     esac
  75. fi
  76. if test " $answer" = " y"
  77. then
  78.     echo 'This will affect where C News directories go.  We recommend'
  79.     echo 'making the directories wherever they have to go and then making'
  80.     echo 'symbolic links to them under the standard names that are used'
  81.     echo 'as defaults in the following questions.  Should such links'
  82.     ./query 'be made [yes]? '
  83.     read makelinks
  84.     case "$makelinks" in
  85.     y*|Y*|'')    makelinks=y    ;;
  86.     esac
  87.     echo 'Our 4.4ish friends suggest putting articles in /var/spool/news'
  88.     echo 'and control files in /usr/share/news, with programs left where'
  89.     echo 'they are in /usr/lib/newsbin.'
  90. fi
  91.  
  92. needsubst=
  93. echo
  94. echo 'C News lives primarily under three directories:  one for articles (and'
  95. echo 'incoming and outgoing spooling), one for control files, and one for'
  96. echo 'programs.'
  97. ./query 'Where should articles live [/usr/spool/news]? '
  98. read newsarts
  99. case "$newsarts" in
  100. '')    newsarts=/usr/spool/news    ;;
  101. *)    needsubst=y    ;;
  102. esac
  103. ./query 'Where should control files live [/usr/lib/news]? '
  104. read newsctl
  105. case "$newsctl" in
  106. '')    newsctl=/usr/lib/news    ;;
  107. *)    needsubst=y    ;;
  108. esac
  109. ./query 'Where should programs live [/usr/lib/newsbin]? '
  110. read newsbin
  111. case "$newsbin" in
  112. '')    newsbin=/usr/lib/newsbin    ;;
  113. *)    needsubst=y    ;;
  114. esac
  115. if test " $makelinks" = " y"
  116. then
  117.     realarts="$newsarts"
  118.     realctl="$newsctl"
  119.     realbin="$newsbin"
  120.     newsarts="/usr/spool/news"
  121.     newsctl="/usr/lib/news"
  122.     newsbin="/usr/lib/newsbin"
  123. fi
  124.  
  125. echo
  126. echo 'C News by default assumes that all normal Unix programs can be found'
  127. echo 'in /bin or /usr/bin.  This is naive, especially on Berkeley-derived'
  128. echo 'systems where some standard programs inexplicably moved to /usr/ucb.'
  129. newspath='/bin:/usr/bin'
  130. if test '(' ! -f /bin/wc -a ! -f /usr/bin/wc ')' -o \
  131.             '(' ! -f /bin/hostname -a ! -f /usr/bin/hostname -a \
  132.                         -f /usr/ucb/hostname ')'
  133. then
  134.     echo 'It would appear that some standard programs live in /usr/ucb'
  135.     ./query 'on your system.  Is that right [yes]? '
  136.     read ucb
  137. else
  138.     echo 'It would appear that /usr/ucb does not exist or is not needed'
  139.     ./query 'for normal operation on your system.  Is that right [yes]? '
  140.     read ucb
  141.     case "$ucb" in
  142.     y*|Y*|'')    ucb=no    ;;
  143.     n*|N*)        ucb=yes    ;;
  144.     esac
  145. fi
  146. case "$ucb" in
  147. y*|Y*|'')    ./query 'Should /usr/ucb go before or after /bin and /usr/bin [after]
  148.  '
  149.         read answer
  150.         case "$answer" in
  151.         a*|A*|'')    newspath="$newspath:/usr/ucb"    ;;
  152.         *)        newspath="/usr/ucb:$newspath"    ;;
  153.         esac
  154.         needsubst=y
  155.         ;;
  156. esac
  157. while true
  158. do
  159.     echo 'Is there any other directory which should be searched to find'
  160.     ./query 'standard programs on your system [no]? '
  161.     read answer
  162.     case "$answer" in
  163.     n*|N*|'')    break    ;;
  164.     *)        needsubst=y    ;;
  165.     esac
  166.     ./query 'What is the full name of the directory? '
  167.     read dir
  168.     ./query 'Should it go before or after the others [after]? '
  169.     read answer
  170.     case "$answer" in
  171.     a*|A*|'')    newspath="$newspath:$dir"    ;;
  172.     *)        newspath="$dir:$newspath"    ;;
  173.     esac
  174. done
  175.  
  176. echo
  177. echo 'C News normally uses a umask of 002, turning off only the others-write'
  178. echo 'bit in the permissions of files used.  (The correspondence between bits'
  179. echo 'and number is:  rwx = 421, so turning off group-write bits and all'
  180. echo 'others-access bits would be a mask of 027, for example.)  Usually'
  181. echo 'a umask of 002 or 022 is appropriate.'
  182. ./query 'What umask should C News use [002]? '
  183. read newsumask
  184. case "$newsumask" in
  185. '')    newsumask=002    ;;
  186. *)    needsubst=y    ;;
  187. esac
  188.  
  189. echo
  190. echo 'C News wants to mail some forms of trouble reports to an administrator.'
  191. echo 'You probably want to make this a system mailbox, rather than that of a'
  192. echo "specific user, so you won't have to change the software when you get a"
  193. echo 'new administrator.'
  194. ./query 'Where should C News mail trouble reports [usenet]? '
  195. read newsmaster
  196. case "$newsmaster" in
  197. '')    newsmaster=usenet    ;;
  198. *)    needsubst=y    ;;
  199. esac
  200.  
  201. echo
  202. echo 'The shell files that are everywhere in C News want to pick up their'
  203. echo 'configuration parameters (mostly, the last few questions you have'
  204. echo 'answered) from a file at a known location; this is very hard to avoid'
  205. echo 'unless you play tricks with environment variables (see documentation).'
  206. echo 'Where should the shell configuration file be'
  207. ./query "located [$newsctl/bin/config]? "
  208. read newsconfig
  209. case "$newsconfig" in
  210. '')    newsconfig=$newsctl/bin/config    ;;
  211. *)    needsubst=y    ;;
  212. esac
  213.  
  214. echo
  215. ./query 'What is the full pathname of the chown command [/etc/chown]? '
  216. read chown
  217. case "$chown" in
  218. '')    chown=/etc/chown    ;;
  219. esac
  220. echo "Can I say '$chown $newsuid.$newsgid file' to change both the user id"
  221. ./query 'and group id of a file [yes]? '
  222. read chboth
  223. case "$chboth" in
  224. y*|Y*|'')    chboth=y    ;;
  225. esac
  226. if test " $chboth" != " y"
  227. then
  228.     ./query 'Is there a chgrp command to change the group of a file [yes]? '
  229.     read chgrp
  230.     case "$chgrp" in
  231.     n*|N*)    echo 'You will need to edit doit.root by hand before running it.'
  232.         echo "It will assume that 'chown $newsuid.$newsgid' works."
  233.         chboth=y
  234.         ;;
  235.     *)    ./query 'What is the full pathname of the chgrp command [/etc/chgrp]? '
  236.         read chgrp
  237.         case "$chgrp" in
  238.         '')    chgrp=/etc/chgrp    ;;
  239.         esac
  240.         ;;
  241.     esac
  242. fi
  243.  
  244. echo
  245. echo 'building doit.root...'
  246. >doit.root
  247. if test ! -w doit.root
  248. then
  249.     echo 'It appears that I cannot create doit.root.  Aborting.'
  250.     exit 1
  251. fi
  252. (
  253.     echo "umask $newsumask"
  254.     echo 'set -x'
  255.     echo ": making directories..."
  256.     if test " $makelinks" = " y"
  257.     then
  258.         echo "mkdir $realarts $realctl $realbin"
  259.         if test " $realarts" != " $newsarts"
  260.         then
  261.             echo "ln -s $realarts $newsarts"
  262.         fi
  263.         if test " $realctl" != " $newsctl"
  264.         then
  265.             echo "ln -s $realctl $newsctl"
  266.         fi
  267.         if test " $realbin" != " $newsbin"
  268.         then
  269.             echo "ln -s $realbin $newsbin"
  270.         fi
  271.     fi
  272.     n="$newsarts $newsarts/in.coming $newsarts/in.coming/bad"
  273.     n="$n $newsarts/out.going $newsctl $newsctl/bin"
  274.     b="$newsbin"
  275.     echo "for d in $n $b"
  276.     echo "do"
  277.     echo "    if test ! -d \$d"
  278.     echo "    then"
  279.     echo "        mkdir \$d"
  280.     echo "    fi"
  281.     echo "done"
  282.     if test " $chboth" = " y"
  283.     then
  284.         echo "$chown $newsuid.$newsgid $n"
  285.         echo "$chown $binuid.$bingid $b"
  286.     else
  287.         echo "$chown $newsuid $n"
  288.         echo "$chgrp $newsgid $n"
  289.         echo "$chown $binuid $b"
  290.         echo "$chgrp $bingid $b"
  291.     fi
  292.     echo ": done"
  293. ) >>doit.root
  294. echo 'done'
  295.  
  296. echo
  297. echo 'C News has libraries for several kinds of Unix:'
  298. echo '    bsd42    4.2BSD and successors'
  299. echo '    usg    AT&T System V'
  300. echo '    v7    Version 7 (4.1BSD is pretty close, ditto Xenix)'
  301. echo '    v8    Version 8, aka Eighth Edition'
  302. while true
  303. do
  304.     ./query 'Which best describes your system [v7]? '
  305.     read unixkind
  306.     if test " $unixkind" = " "
  307.     then
  308.         unixkind=v7
  309.     fi
  310.     if test -d ../lib$unixkind
  311.     then
  312.         break
  313.     fi
  314.     echo 'Sorry, no such library is supplied.'
  315. done
  316.  
  317. echo
  318. echo 'C News has libraries for small address spaces (16 bits) and big'
  319. echo 'ones (preferably 32 bits, but anything rather bigger than 16).'
  320. while true
  321. do
  322.     ./query 'Which best describes your system [big]? '
  323.     read addrsize
  324.     if test " $addrsize" = " "
  325.     then
  326.         addrsize=big
  327.     fi
  328.     if test -d ../lib$addrsize
  329.     then
  330.         break
  331.     fi
  332.     echo 'Sorry, no such library is supplied.'
  333. done
  334.  
  335. echo
  336. echo 'Systems vary in whether certain library functions and system calls'
  337. echo 'are present.  C News contains reasonably-portable versions of the'
  338. echo 'possibly-missing library functions, and fake versions of the'
  339. echo 'possibly-missing system calls, but it needs to know which are missing.'
  340. fake=
  341. for fn in $mightfake
  342. do
  343.     ./query "Does your system have  $fn() [yes]? "
  344.     read answer
  345.     case "$answer" in
  346.     y*|Y*|'')    ;;
  347.     *)    fake="$fake $fn.o"    ;;
  348.     esac
  349. done
  350. ./query "Does your system have a library function ldiv() as in ANSI C? [yes]? "
  351. read answer
  352. case "$answer" in
  353. y*|Y*|'')    ;;
  354. *)    fake="$fake ldiv.o"    ;;
  355. esac
  356. ./query 'Does your system have the "dbm" library [yes]? '
  357. read answer
  358. case "$answer" in
  359. y*|Y*|'')    ./query 'What is the compile option needed to get it [-ldbm]? '
  360.         read answer
  361.         case "$answer" in
  362.         '')    answer=-ldbm    ;;
  363.         esac
  364.         dbm="DBM=$answer"
  365.         ;;
  366. *)    fake="$fake dbm.o"
  367.     dbm='DBM='
  368.     ;;
  369. esac
  370.  
  371. echo
  372. echo 'Many systems, notably older ones, have implementations of the Standard'
  373. echo 'I/O library ("stdio") in which fgets, fputs, fread, and fwrite, although'
  374. echo 'correct, are quite slow.  We supply versions of these functions which'
  375. echo 'are faster than those in any stdio we know; they are compatible with'
  376. echo 'most AT&T-derived stdios.  If they work on your system, they are a'
  377. echo 'major performance win for C News.  There is a simple compatibility'
  378. echo 'check run after the library is built.  The only system we know of'
  379. echo 'where the test works but the functions do not is SunOS 4.0.'
  380. ./query 'Do you want to use our fast stdio library [yes]? '
  381. read libstdio
  382. case "$libstdio" in
  383. y*|Y*|'')    libstdio=libstdio    ;;
  384. *)        libstdio=        ;;
  385. esac
  386.  
  387. if test " $dbm" != " DBM="
  388. then
  389.     echo
  390.     echo 'Does the store() function in your dbm library return a'
  391.     ./query 'value (some old ones did not) [yes]? '
  392.     read storeval
  393.     case "$storeval" in
  394.     y*|Y*|'')    storeval=y    ;;
  395.     esac
  396. else
  397.     storeval=y
  398. fi
  399.  
  400. found=
  401. for f in $fake dummy
  402. do
  403.     if test " $f" = " index.o"
  404.     then
  405.         found=y
  406.     fi
  407. done
  408. if test " $found" = " "
  409. then
  410.     echo
  411.     echo 'A well-tuned index() function customized to a particular machine'
  412.     echo 'is usually faster than portable C.  Is your index() function'
  413.     ./query 'indeed fast [yes]? '
  414.     read fastindex
  415.     case "$fastindex" in
  416.     y*|Y*|'')    fastindex=y    ;;
  417.     esac
  418. fi
  419.  
  420. echo
  421. echo 'Modern Unixes can generally use the setuid() system call to set the'
  422. echo 'real and effective user ids to the current effective user id.  In'
  423. echo 'old Unixes, only "root" can change the real user id.  This causes'
  424. echo 'various problems for C News.  C News provides a small program named'
  425. echo '"setnewsids" to run setuserid-root; all it does is change user and'
  426. echo 'group ids and then execute C News "relaynews".  It is needed only in'
  427. echo 'systems that are too old to do setuid(geteuid()).  Relaynews invokes'
  428. echo 'it automatically if needed (and it then invokes relaynews in return).'
  429. ./query 'Can this system do setuid(geteuid()) [yes]? '
  430. read sete
  431. case "$sete" in
  432. y*|Y*|'')    sete=y    ;;
  433. esac
  434.  
  435. echo
  436. echo 'Some systems have header files that others lack, and C News'
  437. echo 'is prepared to fake missing ones.'
  438. fakehdrs=
  439. for h in $mightfakehdrs
  440. do
  441.     ./query "Does your system have an ANSI-C-conforming <$h> [yes]? "
  442.     read answer
  443.     case "$answer" in
  444.     y*|Y*|'')    ;;
  445.     *)    fakehdrs="$fakehdrs ../include/$h"    ;;
  446.     esac
  447. done
  448. ./query "Does your system have <sys/timeb.h> [yes]? "
  449. read answer
  450. case "$answer" in
  451. n*|N*)    fakehdrs="$fakehdrs ../include/sys/timeb.h"    ;;
  452. esac
  453.  
  454. echo
  455. echo 'Some old systems think sprintf() returns a value of type "char *".'
  456. echo 'The modern standard is that it returns "int".  Does your sprintf()'
  457. ./query 'return "char *" [no]? '
  458. read answer
  459. case "$answer" in
  460. n*|N*|'')    ;;
  461. *)        echo 'You may have to hand-edit our "libc.h" include file if'
  462.         echo 'your compiler objects to us declaring sprintf() to'
  463.         echo 'return "int".  (This will usually happen only if your'
  464.         echo '<stdio.h> header file declares sprintf() -- some do,'
  465.         echo 'some do not.)  If you do need to edit "libc.h", look'
  466.         echo 'for the definition of "sprvalue".'
  467.         ;;
  468. esac
  469.  
  470. echo
  471. echo 'Very old Unix systems needed the order of object modules in a library'
  472. echo 'chosen very carefully.  V7 introduced "ranlib" which removes the need'
  473. echo 'for this.  Recent System Vs have had the same facility built into "ar"'
  474. echo '(look for "symdef" in the "ar" manual page) so "ranlib" is not needed.'
  475. ./query "Does your system have a 'ranlib' command [no]? "
  476. read ranlib
  477. case "$ranlib" in
  478. n*|N*|'')
  479.     ./query 'Does your "ar" have a "symdef" feature [yes]? '
  480.     read answer
  481.     case "$answer" in
  482.     n*|N*)    echo 'You have trouble and may need to modify doit.bin before'
  483.         echo 'running it.  It will assume "ranlib" is present.'
  484.         ranlib=y
  485.         ;;
  486.     *)    ranlib=
  487.         ;;
  488.     esac
  489.     ;;
  490. *)    ranlib=y
  491.     ;;
  492. esac
  493.  
  494. echo
  495. echo 'Historically the C compiler is named "cc", but this is not true on'
  496. echo 'some systems, and on others there are several different C compilers.'
  497. ./query 'What is the name of the C compiler to be used [cc]? '
  498. read cc
  499. case "$cc" in
  500. '')    cc=    ;;
  501. *)    cc="CC=$cc"    ;;
  502. esac
  503.  
  504. echo
  505. echo 'Historically the only normal compilation option needed for most'
  506. echo 'programs is -O, but again compilers, especially newer ones, differ.'
  507. ./query "What options should be given to the compiler [-O]? "
  508. read copts
  509. case "$copts" in
  510. '')    copts=    ;;
  511. *)    copts="COPTS='$copts'"    ;;
  512. esac
  513.  
  514. echo
  515. ./query 'Does your system have a "hostname" command [yes]? '
  516. read hostname
  517. case "$hostname" in
  518. y*|Y*|'')    hostname=y    ;;
  519. *)    ./query 'Does it have a "uname" command with a "-n" option [yes]? '
  520.     read hostname
  521.     case "$hostname" in
  522.     y*|Y*|'')    hostname=u    ;;
  523.     *)        hostname=    ;;
  524.     esac
  525.     ;;
  526. esac
  527.  
  528. echo
  529. echo 'C News tries to limit the backlog of news batches spooled up for'
  530. echo 'transmission to a site, to control use of disk space.  To do this,'
  531. echo 'it needs to be able to determine the length of the queue of news'
  532. echo 'batches for a particular site.  This is UUCP-version-dependent.'
  533. echo 'There is a good chance that you will have to customize the "queuelen"'
  534. echo 'program.  C News knows about several versions:'
  535. echo '    hdb    Honey DanBer, aka Basic Networking Utilities'
  536. echo '    sub    old uucp with subdirectories (e.g. /usr/spool/uucp/C.)'
  537. echo "    null    don't run uucp or don't care about queue lengths"
  538. while true
  539. do
  540.     ./query 'Which one is most appropriate [hdb]? '
  541.     read uucptype
  542.     case "$uucptype" in
  543.     '')    uucptype=hdb    ;;
  544.     sub)    echo 'Beware -- test "queuelen" to make sure it works.'    ;;
  545.     esac
  546.     case "$uucptype" in
  547.     hdb|sub|null)    break    ;;
  548.     esac
  549.     echo 'Sorry, no such choice is available.'
  550. done
  551.  
  552. echo
  553. echo 'C News often wants to ask how much disk space is available.  The'
  554. echo 'format of output from the "df" command unfortunately varies a lot.'
  555. echo 'C News knows about several different versions:'
  556. echo '    bsd    4.2BSD and later'
  557. echo '    sysv    most System Vs'
  558. echo '    sgi    Silicon Graphics Iris systems'
  559. echo '    v7    plain old style:  no headers or fluff, just name and number'
  560. echo "    null    don't know or don't care how much space is available"
  561. while true
  562. do
  563.     ./query 'Which one is most appropriate [bsd]? '
  564.     read dftype
  565.     case "$dftype" in
  566.     '')    dftype=bsd    ;;
  567.     sysv)    echo 'Beware -- test "spacefor" to make sure it works.'
  568.         echo 'System V "df" formats vary widely, indeed wildly.'
  569.         echo '"Consider it standard".  Sure.'
  570.         ;;
  571.     esac
  572.     case "$dftype" in
  573.     bsd|sysv|sgi|v7|null)    break    ;;
  574.     esac
  575.     echo 'Sorry, no such choice is available.'
  576. done
  577.  
  578. echo
  579. echo 'Some "df" commands, especially on old systems, must be given the'
  580. echo 'name of a device.  Modern ones can be given any directory name and'
  581. echo 'the system handles the details of figuring out what device is meant.'
  582. ./query 'Does your "df" accept a directory name as an argument [yes]? '
  583. read answer
  584. case "$answer" in
  585. n*|N*)    echo 'You are going to have to customize "spacefor" for your system.'
  586.     echo 'It will be generated assuming that directory names do work.'
  587.     ;;
  588. esac
  589.  
  590. echo
  591. ./query 'Are you planning to use expire to archive news on disk [no]? '
  592. read answer
  593. case "$answer" in
  594. y*|Y*)    echo 'You probably want to customize the "archive" entry in'
  595.     echo '"spacefor" so it knows where your archiving is done and how'
  596.     echo 'much space you want free there.'
  597.     ;;
  598. esac
  599.  
  600. echo
  601. ./query 'Are you particularly short of disk space [no]? '
  602. read answer
  603. case "$answer" in
  604. y*|Y*)    echo 'You may want to reconsider whether you really want to get'
  605.     echo 'news, unless you are getting only a very small set of groups.'
  606.     echo 'In any case, you definitely want to inspect "spacefor" and'
  607.     echo 'change some of its thresholds for free space.'
  608.     ;;
  609. *)    echo 'You may want to inspect "spacefor" to make sure its defaults'
  610.     echo 'for things like desired free space are appropriate for your'
  611.     echo 'system, although the defaults are fairly conservative.'
  612.     ;;
  613. esac
  614.  
  615. echo
  616. echo 'Are you running C News on a group of machines hooked together with'
  617. ./query 'NFS, with articles filed on only one "server" machine [no]? '
  618. read answer
  619. server=
  620. case "$answer" in
  621. y*|Y*)    if test " $hostname" = " "
  622.     then
  623.         echo 'With a server but no "hostname" command, you will have'
  624.         echo 'problems and will probably have to tinker by hand to'
  625.         echo 'get a fake "hostname" that does the right thing.  The'
  626.         echo 'generated files will assume you have "hostname".'
  627.         hostname=y
  628.     fi
  629.     if test " $hostname" = " u"
  630.     then
  631.         ./query 'What is the "uname -n" name of the server? '
  632.     else
  633.         ./query 'What is the "hostname" name of the server? '
  634.     fi
  635.     read server
  636.     ;;
  637. esac
  638.  
  639. echo
  640. echo 'Several programs need to know an overall name for the system news is'
  641. echo 'being run on, where "system" may include multiple machines if they'
  642. echo 'share a common set of control files and articles; this is used in'
  643. echo 'article headers and related places.  For uucp sites, this usually'
  644. echo 'should be the uucp name.  What is the name of the overall system'
  645. ./query 'for news purposes? '
  646. read whoami
  647.  
  648. echo
  649. echo 'The "From:" lines of news postings, on the other hand, should carry'
  650. echo 'a mailing address, which in particular should be a domain address'
  651. echo 'for sites that have one.  What is the mailing-address name of this'
  652. ./query "system, preferably a domain address [$whoami.uucp]? "
  653. read mailname
  654. case "$mailname" in
  655. '')    mailname="$whoami.uucp"    ;;
  656. esac
  657.  
  658. echo
  659. echo 'What is the name of the organization, for insertion into articles'
  660. ./query 'posted from here? '
  661. read organization
  662.  
  663. echo
  664. echo 'What user other than root (if any) should be allowed to create'
  665. ./query 'new news groups [no such user]? '
  666. read allowed
  667.  
  668. echo
  669. echo 'Manual pages are normally stored in a tree structure under /usr/man.'
  670. echo 'Local practices vary a great deal, however, and System V has also'
  671. echo 'introduced some bizarre distortions into this once-simple structure.'
  672. ./query 'What is the top-level manual-page directory [/usr/man]? '
  673. read manpages
  674. case "$manpages" in
  675. '')    manpages=/usr/man    ;;
  676. esac
  677.  
  678. echo
  679. chaps='1 5 8'
  680. echo 'C News adds manual pages to chapters 1 (programs), 5 (files), and'
  681. echo '8 (administrative programs).  These chapter numbers have changed'
  682. echo 'in some variants of Unix.  Also, originally pages from chapter 5 (for'
  683. echo "example) were stored in $manpages/man5.  This has also changed in"
  684. ./query 'some variants.  Has your system made either of these changes [no]? '
  685. read answer
  686. case "$answer" in
  687. y*|Y*)    echo 'You will have to hand-edit the last few lines of doit.bin'
  688.     echo 'to install the manual pages where they belong on your system.'
  689.     ;;
  690. esac
  691.  
  692. echo
  693. echo 'The "rnews" and "cunbatch" commands (which are identical, the latter'
  694. echo 'being purely for backward compatibility with seriously-old systems)'
  695. echo 'have to be installed somewhere where uucp can find them to execute'
  696. echo 'them.  It is not normally necessary for users to be able to run'
  697. echo 'them, so they need not go in the directories searched for normal'
  698. echo 'commands... although uucp often searches only those directories.'
  699. ./query 'What directory should "rnews" and "cunbatch" go in [/bin]? '
  700. read rbin
  701. case "$rbin" in
  702. '')    rbin=/bin    ;;
  703. esac
  704.  
  705. echo
  706. echo 'The "inews", "postnews", "readnews", and "checknews" commands should'
  707. echo 'go in one of the directories searched for normal commands, so users'
  708. echo 'can run them without special arrangements.  What directory should'
  709. ./query 'these commands go in [/bin]? '
  710. read bin
  711. case "$bin" in
  712. '')    bin=/bin    ;;
  713. esac
  714.  
  715. echo
  716. echo 'For replies to control messages, C News invokes "mail" (typically'
  717. echo '/bin/mail unless you make special arrangements) with either an'
  718. echo 'Internet-style "@" address or a uucp-style "!" address.  Internet'
  719. echo 'style is probably better... if your mailer supports it at all.'
  720. ./query 'Will "mail" handle "@" addresses [no]? '
  721. read atok
  722. case "$atok" in
  723. y*|Y*)    atok=y    ;;
  724. *)    atok=    ;;
  725. esac
  726.  
  727. echo
  728. echo 'Postnews can supply a default newsgroup, to assist naive users in'
  729. echo 'getting the group right for simple postings.  What should the default'
  730. ./query 'newsgroup for postnews be [no default]? '
  731. read postdefltgroup
  732.  
  733. echo
  734. echo 'Postnews can supply a default distribution, to restrict news to a'
  735. echo 'local area unless the user specifically changes it.  This is probably'
  736. echo 'a good idea.  What should the default distribution for postnews'
  737. ./query 'be [world]? '
  738. read postdefltdist
  739.  
  740. echo
  741. echo 'building doit.bin...'
  742. >doit.bin
  743. if test ! -w doit.bin
  744. then
  745.     echo 'It appears that I cannot create doit.bin.  Aborting.'
  746.     exit 1
  747. fi
  748. (
  749.     echo "umask $newsumask"
  750.     echo "set -x"
  751.     echo ': setting up for substitutions'
  752.     echo "cat >nsubstitutions <<'!'"
  753.     cat <<!
  754. # master substitutions file
  755. #
  756. # where the programs live (see also NEWSCONFIG)
  757. NEWSBIN        $newsbin
  758. # where the control files live
  759. NEWSCTL        $newsctl
  760. # where the articles live
  761. NEWSARTS    $newsarts
  762. # what PATH should be used for finding normal programs
  763. # (things not in NEWSBIN, that is)
  764. NEWSPATH    $newspath
  765. # the umask under which files should be created
  766. NEWSUMASK    $newsumask
  767. # who to send mail to when there is trouble
  768. NEWSMASTER    $newsmaster
  769. # configuration file that lets shell files pick up all of this
  770. NEWSCONFIG    $newsconfig
  771. !
  772.     echo '!'
  773.     echo 'if test -r substitutions && cmp -s nsubstitutions substitutions'
  774.     echo 'then'
  775.     echo '    rm nsubstitutions'
  776.     echo 'else'
  777.     echo '    mv nsubstitutions substitutions'
  778.     echo 'fi'
  779.     echo ': done'
  780.     echo ': building headers'
  781.     echo 'cd ..'
  782.     echo 'if test ! -d include'
  783.     echo 'then'
  784.     echo '    mkdir include include/sys'
  785.     echo 'fi'
  786.     echo 'cd h'
  787.     echo 'rm -f nnewshsed'
  788.     if test " $fastindex" != " y"
  789.     then
  790.         echo 'echo "/FASTINDEX.*qqq/s;^;/* ;" >>nnewshsed'
  791.     fi
  792.     if test " $storeval" = " y"
  793.     then
  794.         echo 'echo "/NOSTOREVAL.*qqq/s;^;/* ;" >>nnewshsed'
  795.     fi
  796.     if test " $addrsize" = " big"
  797.     then
  798.         echo 'echo "/SMALLMEM.*qqq/s;^;/* ;" >>nnewshsed'
  799.     fi
  800.     echo 'if test -f newshsed && cmp -s nnewshsed newshsed'
  801.     echo 'then'
  802.     echo '    rm -f nnewshsed'
  803.     echo 'else'
  804.     echo '    mv nnewshsed newshsed'
  805.     echo 'fi'
  806.     echo 'make all || exit 1'
  807.     echo 'cd ../hfake'
  808.     echo "ed - Makefile <<'!'"
  809.     echo "/NEEDED =/s~.*~NEEDED = $fakehdrs~"
  810.     echo "w"
  811.     echo "!"
  812.     echo "make all || exit 1"
  813.     echo ": done"
  814.     echo ": making substitutions..."
  815.     echo "cd ../conf"
  816.     if test " $needsubst" = " y"
  817.     then
  818.         echo "make substs"
  819.     else
  820.         echo ": make substs        not necessary, defaults used"
  821.     fi
  822.     echo ": done"
  823.     echo ": making spacefor, queuelen, etc...."
  824.     echo "rm -f spacefor queuelen hostname setnewsids"
  825.     echo "make spacefor.$dftype"
  826.     echo "cp spacefor.$dftype spacefor"
  827.     echo "make queuelen.$uucptype"
  828.     echo "cp queuelen.$uucptype queuelen"
  829.     if test " $hostname" = " y"
  830.     then
  831.         echo "# ( echo '#! /bin/sh' ; echo 'echo $whoami' ) >hostname"
  832.     elif test " $hostname" = " u"
  833.     then
  834.         echo "( echo '#! /bin/sh' ; echo 'uname -n' ) >hostname"
  835.     else
  836.         echo "( echo '#! /bin/sh' ; echo 'echo $whoami' ) >hostname"
  837.     fi
  838.     echo ': done'
  839.     echo ': making library...'
  840.     if test " $ranlib" = " y"
  841.     then
  842.         echo "touch ../ranlibed"
  843.         echo "sleep 2"
  844.     fi
  845.     echo "for dir in lib$unixkind lib$addrsize libc libcnews $libstdio"
  846.     echo "do"
  847.     echo "    cd ../\$dir"
  848.     echo "    make u $cc $copts || exit 1"
  849.     echo "done"
  850.     echo "cd ../libfake"
  851.     echo "ed - Makefile <<'!'"
  852.     echo "/NEEDED =/s/.*/NEEDED = $fake/"
  853.     echo "w"
  854.     echo "!"
  855.     echo "make u $cc $copts || exit 1"
  856.     echo "cd ../conf"
  857.     if test " $ranlib" = " y"
  858.     then
  859.         echo "make ../ranlibed"
  860.     fi
  861.     echo ': library done'
  862.     if test " $libstdio" != " "
  863.     then
  864.         echo ': testing libstdio'
  865.         echo 'cd ../libstdio'
  866.         echo "make trials $cc $copts || exit 1"
  867.         echo ': done'
  868.     fi
  869.     echo ': building programs'
  870.     echo 'cd ../conf'
  871.     if test " $sete" != " y"
  872.     then
  873.         echo "make setnewsids NEWSUSER=$newsuid NEWSGROUP=$newsgid $cc $copts"
  874.     fi
  875.     echo "for dir in $pgmdirs"
  876.     echo "do"
  877.     echo "    cd ../\$dir"
  878.     echo "    make all $dbm $cc $copts"
  879.     echo "done"
  880.     echo ": done"
  881.     echo ": building prototype control files"
  882.     echo "cd ../conf"
  883.     echo "rm -f $ctlf"
  884.     echo "cp config.proto config"
  885.     echo "echo '$mailname' >mailname"
  886.     echo "echo '$organization' >organization"
  887.     if test " $allowed" != " "
  888.     then
  889.         echo "echo '$allowed' >allowed"
  890.     fi
  891.     if test " $server" != " "
  892.     then
  893.         echo "echo '$server' >server"
  894.     fi
  895.     if test " $atok" != " y"
  896.     then
  897.         echo echo "'replies must use "!" addresses' >replyusepath"
  898.     fi
  899.     if test " $postdefltdist" != " "
  900.     then
  901.         echo "echo '$postdefltdist' >>postdefltdist"
  902.     fi
  903.     if test " $postdefltgroup" != " "
  904.     then
  905.         echo "echo '$postdefltgroup' >>postdefltgroup"
  906.     fi
  907.     echo "echo '$whoami' >whoami"
  908.     echo "echo 'general 00000 00000 y' >active"
  909.     echo "echo 'news.announce.newusers 00000 00000 y' >>active"
  910.     echo ">errlog"
  911.     echo ">history"
  912.     echo ">history.pag"
  913.     echo ">history.dir"
  914.     echo "echo 'general    general local news' >localgroups"
  915.     echo ">log"
  916.     echo "echo 'all    uunet!%s' >mailpaths"    # crude
  917.     echo "cp sys.proto sys"
  918.     echo "cat >cron <<'!'"
  919.     cat <<!
  920. 15 *    1-31 *    0-6    su news -c '$newsbin/input/newsrun'
  921. 30 8    1-31 *    1-5    su news -c '$newsbin/input/newsrunning off'
  922. 00 17    1-31 *    1-5    su news -c '$newsbin/input/newsrunning on'
  923. 40 *    1-31 *    0-6    su news -c '$newsbin/batch/sendbatches'
  924. 59 0    1-31 *    0-6    su news -c '$newsbin/expire/doexpire'
  925. 45 3    1-31 *    0-6    su news -c '$newsbin/expire/superkludge comp.mail.maps'
  926. 10 8    1-31 *    0-6    su news -c '$newsbin/maint/newsdaily'
  927. 00 5,13,21    1-31 *    0-6    su news -c '$newsbin/maint/newswatch'
  928. !
  929.     echo "!"
  930.     echo "echo 'su news -c $newsbin/maint/newsboot' >rc"
  931.     echo ": done"
  932.     echo ': installing programs'
  933.     echo "for dir in $pgmdirs"
  934.     echo "do"
  935.     echo "    cd ../\$dir"
  936.     echo "    make bininstall BIN=$bin RBIN=$rbin $dbm"
  937.     echo "done"
  938.     echo ": done"
  939.     echo ': installing manual pages'
  940.     echo 'cd ../man'
  941.     for chap in $chaps
  942.     do
  943.         for f in `ls ../man | egrep "\.$chap\$"`
  944.         do
  945.             echo "cp $f $manpages/man$chap/$f"
  946.         done
  947.     done
  948.     echo ': done'
  949. ) >>doit.bin
  950. echo 'done'
  951.  
  952. echo
  953. echo 'building doit.news...'
  954. >doit.news
  955. if test ! -w doit.news
  956. then
  957.     echo 'It appears that I cannot create doit.news.  Aborting.'
  958.     exit 1
  959. fi
  960. (
  961.     echo "umask $newsumask"
  962.     echo 'set -x'
  963.     echo ': installing programs'
  964.     echo "for dir in $pgmdirs"
  965.     echo "do"
  966.     echo "    cd ../\$dir"
  967.     echo "    make newsinstall BIN=$bin RBIN=$rbin $dbm"
  968.     echo "done"
  969.     echo ": done"
  970.     echo ": installing control files"
  971.     echo "cd ../conf"
  972.     echo "for f in $ctlf"
  973.     echo "do"
  974.     echo "    if test -r $newsctl/\$f"
  975.     echo "    then"
  976.     echo "        echo \"$newsctl/\$f already exists; left unchanged\""
  977.     echo "    elif test ! -r \$f"
  978.     echo "    then"
  979.     echo "        : \"\$f\" not wanted"
  980.     echo "    else"
  981.     echo "        cp \$f $newsctl/\$f"
  982.     echo "    fi"
  983.     echo "done"
  984.     echo "if test -r $newsconfig"
  985.     echo "then"
  986.     echo "    echo '$newsconfig already exists; left unchanged'"
  987.     echo "else"
  988.     echo "    cp config $newsconfig"
  989.     echo "    chmod +x $newsconfig"
  990.     echo "fi"
  991.     echo ": It is virtually certain that some of those control files"
  992.     echo ": need modifying to suit your system.  In particular, you"
  993.     echo ": should pick up a current 'active' file from your neighbors."
  994.     echo ": done"
  995. ) >>doit.news
  996. echo 'done'
  997.  
  998. echo
  999. echo 'building again.root...'
  1000. >again.root
  1001. if test ! -w again.root
  1002. then
  1003.     echo 'It appears that I cannot create again.root.  Aborting.'
  1004.     exit 1
  1005. fi
  1006. (
  1007.     echo "umask $newsumask"
  1008.     echo 'set -x'
  1009.     if test " $sete" != " y"
  1010.     then
  1011.         echo ": installing setnewsids"
  1012.         echo "cp setnewsids $newsctl"
  1013.         echo "$chown root $newsctl/setnewsids"
  1014.         echo "chmod u+s $newsctl/setnewsids"
  1015.         echo ": done"
  1016.     fi
  1017.     echo ": setting uids for setuid programs..."
  1018.     them="$newsbin/input/newsspool $newsbin/relay/relaynews"
  1019.     if test " $chboth" = " y"
  1020.     then
  1021.         echo "$chown $newsuid.$newsgid $them"
  1022.     else
  1023.         echo "$chown $newsuid $them"
  1024.         echo "$chgrp $newsgid $them"
  1025.     fi
  1026.     echo "chmod u+s,g+s $them"
  1027.     echo ": done"
  1028. ) >>again.root
  1029. echo 'done'
  1030.  
  1031. echo
  1032. chmod +x doit.root doit.bin doit.news again.root
  1033. echo 'You should now run doit.root as root (or as somebody with the power'
  1034. echo "to create $newsctl, $newsarts, and $newsbin"
  1035. echo "and run chown), doit.bin as $binuid, doit.news as $newsuid, and"
  1036. echo "again.root as root (or as somebody with the power to run chown),"
  1037. echo 'in that order.  Finally, you will want to add the contents of'
  1038. echo "'cron', or something similar, to your cron's work-to-be-done"
  1039. echo "file(s), and the contents of 'rc', or something similar, to"
  1040. echo '/etc/rc or whatever your system executes when booting.'
  1041. echo
  1042. echo '"make gclean" will clean up everything afterwards.  "make lclean"'
  1043. echo 'does a less drastic cleanup affecting only the library directories.'
  1044. echo '"make spotless" does "make gclean" and also removes the doit files.'
  1045. echo
  1046. echo 'Good luck and happy news reading.'
  1047.